Object linked materials.
If you wish to have one material per object, suggest using object linked materials. Have explained this somewhat in https://blender.stackexchange.com/a/185428/15543
Albeit @ZargultheWizard's simple script will work in the question example case, where there are two distinct meshes the cube and the cone, if they were not then would end up with same material on each, that being the last copy, resulting in horrible names and unused originals. To ensure each object has its own material will instead use object linked materials.
Running script below "should" result in all scene objects that have an active material, having their own object linked material named after the object.
import bpy
from collections import defaultdict
context = bpy.context
scene = context.scene
mats = defaultdict(list)
for o in scene.objects:
if not o.active_material:
continue
mats[o.active_material].append(o)
# change to object linked material
o.material_slots[o.active_material_index].link = 'OBJECT'
for m, obs in mats.items():
# keep and rename the first
o = obs.pop(0)
m.name = o.name
o.active_material = m
# copy and rename the rest
for o in obs:
o.active_material = m.copy()
o.active_material.name = o.name