It's a combination of both, however most people may be more suited to continue eating a modest amount of junk food and then exercising to compensate than completely overhauling their eating habits and doing a lesser amount of exercise.
i think the diet is more important but for healthy weightloss and achieving a better body you need to reduce how much your consuming and exercise aswell.
If a fat person reduces their calories and does no exercise, they'll lose weight.
If that same fat person does some exercise, and eats as much as they like - probably more than before, as they'll be hungrier from the exercise, they wont lose weight.
Hence, when losing weight, diet is the most important factor.