Are you asking solely about those two sentences, or are you wanting to understand more about the difference between when to use the infinitive, and when to use the gerund?