Human mobility and population heterogeneity in the spread of an epidemic