There are a number of similarities between these two exercise options. Both offer a great cardiovascular conditioning solution and both will improve a range of muscle groups.
The treadmill will be more useful if you are actually training for a running competition or prefer to supplement your training program indoors due to bad weather. As a treadmill imitates as near as possible a running or jogging gait, it is ideal for this purpose. Indeed, it can also be used for walking exercise.
Although the alternative might be to go outside, the weather can again be a deciding factor and one should not underestimate the attraction of meeting in a social environment such as a gym to motivate continuing with an exercise program long term.
An elliptical machine workout however does have a big advantage in targeting such a large range of muscles in the body. The legs and lower body are improved with the step motion required whilst the upper body, notably the arms and the back and shoulders are strengthened by pulling and pushing the handle bars. On top of this, you have the option to set the machine to allow backward pedaling or to work without the handles which focuses more on the lower body.
Both the treadmill and elliptical include models that will allow you to change the incline setting, but the additional variation of the elliptical means you have more options when planning your exercise program. Furthermore, it does not require you to remove your feet from the foot plates and so does not exert any significant pressure on joints and muscles, reducing injury. This characteristic makes it ideal if you are on your way back from a serious injury or have bad knees or arthritis for example.
The two options have their own advantages and disadvantages and which one to go for does depend in part on personal circumstances and preferences. On the whole though, the elliptical allows for more variety, targets more of the muscles in your body and causes lower stress levels whilst the treadmill is better as a supplement to a walking or running exercise program.