that is because allah would not change a favor which he had bestowed upon a people until they change what is within themselves. and indeed allah is hearing and knowing.
ذلك بأن الله لم يك مغيرا نعمة أنعمها على قوم حتى يغيروا ما بأنفسهم وأن الله سميع عليم