A theory of learning data statistics in diffusion models, from easy to hard