The process of creating 2D depictions is explained in detail here. This way, it is possible to create a 2D image via running e.g.
obabel -O 2d_depiction.png
However, how do I generate a ball and stick 3d depiction (as image) instead?
Open Babel does not generate "ball and stick 3D depictions" directly, because it's not a molecular visualization program.
That's why we started Avogadro.
There are a few formats supported in Open Babel to write out 3D depictions, e.g.:
But you can make a pseudo-3D "ball and stick" depiction in the SVG format:
obabel [file] -O file.svg -xS