I think those sentences mean nearly the same thing. However, I get a slightly different feeling from the infinitive and the gerund.
When I hear “ways to relax”, it sounds to me as if there is an intention. “Hmm. I need to relax. What method should I use?” So, “ways to relax” sounds to me like “methods used for the intentional purpose of relaxation”. To me, a way to relax would be something like hydrotherapy, massage or some hobby done because the person has consciously thought, “I need to relax.”
When I hear “ways of relaxing”, it sounds to me like “styles of relaxing”. It sounds less intentional, and as if the person just informally falls into a certain style when he relaxes. I think of a guy coming home from work, letting out a sigh, popping open a beer, and watching TV. He might also do a hobby, but whatever activity he chooses, it’s not a self-conscious choice for the conscious purpose of relaxing.
This is the feeling I get, but I’ll bet that some people won’t perceive a difference, and in some cases I know I even I don’t notice much of a difference between use of the gerund and the infinitive.