There is no firm rule about this, but in general we use "for" to talk about thoughts and feelings, and "to" when discussing more objective things. So, for example, getting a driving license is important TO somebody because they now have new ways to travel; but it can also be important FOR that person to feel more independent. In many cases, though, the prepositions are basically the same (e.g., "interesting to/for me").