Just to add - that these are the Hohmann transfer orbits. There's also the possibility of ballistic capture. If you use that method, you can transfer to Mars at any time. And the total delta v involved is simlar to Hohmann transfer. It's a new idea, not yet used for any missions but may be used in the future, more work to be done on it.