It's simply a matter of what each thing is designed to do.
If a heart has stopped completely (asystole or 'flatline'), then an AED is useless. You can try CPR and epinephrine, and in the best case scenario, you might get the heart into a condition where you can use the defibrillator.
A defibrillator is useful when the heart is beating in a chaotic fashion (or _way_ too fast). The electrical shock it delivers completely stops the heart, in the hopes that the heart's internal pacemaker can take over again.
CPR can't 'reset' the heart, all it can do it help slow down the dying process until you can get a defibrillator in use. Without the defibrillator, the heart will progress into a state where even the defibrillator won't be useful.
Here's the basic protocol:
1) If it's a child, do two minutes of CPR before using the AED (the most common cause of cardiac arrest in kids is respiratory arrest, so ventilating them is sometime all they need)
2) If it's an adult, and they've been down for more than a few minutes, do 2 minutes of CPR to 'prime' the heart to make it more 'shockable'
3) If it's an adult, and you just witnessed the arrest, use the AED straight away. Their heart is likely still oxygenated enough to restart easily. If they're not breathing, be sure to fix that...
http://www.heart.org/acls