This is an awkward / twisted question to answer.
Diesel engines run much higher compression ratios than petrol engines and they run a lot hotter, so the oil is formulated to deal with this. Plus they produce a lot more dirt in terms of combustion by-products. Diesel-rated oils typically have more detergents in them to deal with this. It's not unheard of for diesel oils to clean a petrol engine so well that it loses compression. Diesel-rated oils also have an anti-foaming agent in them which is unique to diesel engines, and not needed in petrol engines.
So is that the be-all and end-all answer? Well not really and that's why this is a difficult question to give a straight answer to. The above statement is more relevant to commercial diesel engines. Nowadays, just about all passenger car and jdm junk coming to PK / light commercial oils (including OEM ones designed for both petrol and diesel engines) will carry the generic specifications. ie. formulated to satisfy the requirements for both types of engine. So just because the oil is labelled "Diesel" doesn't mean it's not suitable for petrol engines - it will more than likely carry an ACEA A3 / OEM petrol spec as well.
However you do need to be a bit careful regarding choosing the right oil spec - if you have a modern common efi engine, it may require at least 5w-30 rating SN/SP / SG grade