Is it necessary to convert a python script from bpy.context / bpy.ops to bpy.data to run it withou gui via command-line?
bpy.context works perfectly fine from the command line. Here is a set of scripts for doing useful things with Blender from the command line, and a couple of them (render-batch and apply-compositor) make references to bpy.context.

Note also the technique of wrapping the Python code in a shell script, so the user can conveniently invoke the scripts as though they were commands in their own right.