Dust evolution from circumstellar environments to comets