  In this paper we study the problem of computing wavelet coefficients of
compactly supported functions from their Fourier samples. For this, we use the
recently introduced framework of generalized sampling. Our first result
demonstrates that using generalized sampling one obtains a stable and accurate
reconstruction, provided the number of Fourier samples grows linearly in the
number of wavelet coefficients recovered. For the class of Daubechies wavelets
we derive the exact constant of proportionality.
  Our second result concerns the optimality of generalized sampling for this
problem. Under some mild assumptions we show that generalized sampling cannot
be outperformed in terms of approximation quality by more than a constant
factor. Moreover, for the class of so-called perfect methods, any attempt to
lower the sampling ratio below a certain critical threshold necessarily results
in exponential ill-conditioning. Thus generalized sampling provides a
nearly-optimal solution to this problem.
