They are similar in that they are forms of uncontrolled combustion in the chamber - but they are not the same things.
Pre-ignition or Auto-Ignition is just what it suggests. The fuel/air mixture in vapor form is ignited prior to when the spark is provided to the plug. It's usually from a cobination of lower octane fuel plus a locallized hot spot. That ignition source could be from pressure, heat soak, sharp edges or whatnot - but it's not "spontaneous". It is noisey and robs power, but is not as damaging catostrophic because the pressure spike isn't as abrupt or powerful.
Detonation comes from liquid fuel (fuel suspended but not in a vapor form) igniting from presure and temperature and exploding with the result of a supersonic pressure wave within the cylinder. The pressure from this event is much higher than pressure from a controlled burn, and it's over a much shorter duration.
In terms of something easier to picture:
Pinging is you getting a car moving by pushing a car forward from a dead stop, but a friend runs in and pulls the car back just before you push and keeps doing it while you're trying to go forward. It's harder to get it going in the direction you want, but little damage will result from this happening occasionally. if it happens constantly eventually you bend something.
Detonation is getting rear ended from another car going a few miles per hour. It doesn't take long for something to give.