Sometimes the gerund and infinitive forms are interchangeable; sometimes they are not. Your examples above ("travelling", "dancing", "getting") are all examples of interchangeable usage. Here are examples where interchanging alters the meaning of the sentence:
"Travelling" vs "to travel":
- He remembered travelling to Canada. (He has traveled to Canada, and
now remembers that.)
- He remembered to travel to Canada. (He was supposed to go to Canada, and then he did.)
"Dancing" vs "to dance":
- She stopped dancing. (She never danced again.)
- She stopped to dance. (She interrupted an activity to begin dancing.)
How do you know when the gerund and infinitive are interchangeable? Generally, gerunds are best for talking about completed actions, and infinitives are best for talking about incomplete or future actions.
Gerund: I was getting up earlier last week. (The getting up already heppened.)
Infinitive: I want to get up earlier. (The getting up hasn't happened yet.)
Still, knowing which form to use requires some memorization and intuition. Here is a list of common verbs from http://www.gingersoftware.com/content/grammar-rules/verbs/gerunds-and-infinitives/:
Followed by a gerund:
admit, advise, avoid, be, used to, can’t help, can’t stand, consider, deny, discuss, dislike, end up, enjoy, feel like, finish, forget, get used to, give up, go on, have difficulty, have problems, have trouble, imagine, it’s no use, it’s worthwhile, keep, look forward to, mention, mind, miss, recommend, remember, quit, spend time, stop, suggest, understand, waste time, work at
Followed by either a gerund or an infinitive without causing a change in meaning:
begin, continue, hate, intend, like, love, prefer, start
Followed by a gerund or infinitive but with a change in meaning:
forget, remember, stop
Followed by an infinitive:
afford, agree, appear, arrange, ask, care, decide, demand, expect, fail, forget, hope, learn, manage, mean, offer, plan, prepare, pretend, promise, refuse, remember, seem, stop, volunteer, wait, want, wish
Followed by a noun or pronoun and then by an infinitive:
advise, allow, ask, cause, challenge, command, convince, expect, forbid, force, hire, instruct, invite, order, pay, permit, program, remind, teach, tell, urge, want, warn