Both strength training and cardiovascular exercise have their own specific advantages. Cardio is usually linked to weight loss and improving muscular endurance while strength training is thought of as a workout only for those wanting to get buff. While these generalizations are somewhat true, you shouldn't limit yourself to only one form of exercise no matter what your goals are.
If you're trying to lose weight, the first exercise most people will tell you to do is some sort of cardio: running on the treadmill, using the elliptical or riding the stationary bike. Cardio is excellent for weight loss because it burns such a large amount of calories. Most people that are trying to lose weight go 100% on the cardio and completely ignore strength training.
Strength training also has some benefits for weight loss, mainly increased muscle mass. An increase in the amount of muscle mass you carry will speed up your metabolism to help you burn more calories and lose weight even faster.
If you're trying to gain muscle, only focusing on lifting weights might not give you the best results. Gaining muscle requires a large calorie surplus. Most of the time, when you gain muscle, you also gain quite a bit of fat which you end up having to lose during your cutting phase. If you are engaged in cardio while gaining weight, the amount of fat you put on will be minimized and when you need to increase your cardio to lose some of the fat you did gain, it won't be so hard to do since you'll be used to all the cardio you've been doing.
The Bottom Line
So while both forms of exercise can help certain situations, it shouldn't be an all and nothing approach. If you want to lose weight you shouldn't be doing all cardio without any strength training. The same goes for gaining muscle or simply trying to live a healthy lifestyle. No single form of exercise will give you everything your body needs.