A dynamo converts mechanical energy into electrical energy using the principle of electromagnetic induction, which is a magnetic effect of electric current.