Attribute error while declaring correct variables
As the error suggests, there is no lamp property in bpy.context and as you found context.active_object.data gives you the properties you are after when a lamp is selected.

Unlike a camera, there is no "active" lamp and there could be hundreds of lamps in a scene. You will most likely want to test if the active object is a lamp and display it's properties if it is.

if context.active_object.type == 'LAMP':
    lamp = context.active_object.data
    layout.prop(lamp, "type", expand=True)