add "align object to view" to addon
You can retrieve the required matrix from the view_matrix attribute of the 3D View space. It needs to be transposed and values in the 4th row and column be reset. Finally, you may set the translation components to the cursor location to get the behavior in line with the standard mesh add operators:

import bpy
import bmesh


class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"

    @classmethod
    def poll(cls, context):
        return context.mode == 'OBJECT' and context.area.type == 'VIEW_3D'

    def execute(self, context):

        scene = context.scene

        bm = bmesh.new()
        bmesh.ops.create_cube(bm)

        me = bpy.data.meshes.new("Cube")
        bm.to_mesh(me)

        ob = bpy.data.objects.new("Cube", me)
        mat = context.space_data.region_3d.view_matrix.transposed().to_3x3().to_4x4()
        mat.translation = scene.cursor_location
        ob.matrix_world = mat

        scene.objects.link(ob)
        scene.update()

        return {'FINISHED'}


def register():
    bpy.utils.register_class(SimpleOperator)


def unregister():
    bpy.utils.unregister_class(SimpleOperator)


if __name__ == "__main__":
    register()

    for area in bpy.context.screen.areas:
        if area.type == 'VIEW_3D':
            ctx = bpy.context.copy()
            ctx["area"] = area
            ctx["region"] = area.regions[-1]
            ctx["space_data"] = area.spaces.active
            bpy.ops.object.simple_operator(ctx)
            break