They both have the same meaning, and often be used interchangeably. Although I would use encourage when referring to people, e.g. "I encouraged him to keep improving"; and stimulate for more scientific contexts or for inanimate objects, e.g, "The presence of food stimulated bacterial growth". In these two sentences, it still makes sense if you switched encouraged and stimulated, but they are more appropriate in the context given.