A dielectric slab will be attracted towards any source of electric field, because it is essentially a collection of dipoles. Dipoles in fields align with the fields. If the field varies in space, the dipole is drawn to the local maximum of the field. An intuitive, everyday example of this is the way iron filings are drawn to a magnet.
In the case of a constant voltage capacitor, the battery supplies the extra energy. We can see this most simply in the case that we replace the battery with a very large capacitor of capacitance $C$ connected in parallel with our original capacitor with capacitance $c_0 \ll C$. Originally, each capacitor is at a voltage $V_0$, and the large capacitor has charge $Q_0=CV_0$ while the small capacitor has charge $q_0=c_0V_0$. As we insert the dielectric, $c_0$ changes by $\Delta c$. The capacitors then settle in the new condition of equal voltage
$$\frac{Q_0-\Delta q}{C} = \frac{q_0 + \Delta q}{c_0 + \Delta c}$$
Solving for $\Delta q$ using the fact that $c_0 +\Delta c \ll C$ gives
$$\Delta q = Q_0 \frac{c_0 + \Delta c}{C} - q_0$$
From this it is fairly easy to show that the energy change in the original capacitor is
$$\Delta U_c=\frac{1}{2}\Delta c V_0^2$$
What about the change in the large capacitor? There we have
$$\Delta U_C = \frac{1}{2C}((Q-\Delta q)^2 - Q^2) \approx -\frac{\Delta q\, Q}{C}$$
Substituting gives
$$\Delta U_C=-\Delta c V_0^2$$
So overall the system ends with a lower energy, and the slab should be attracted.
Best Answer
The calculation by Ben clearly shows that the total energy stored in the battery and the capacitor is lower for the final situation than for the initial situation. Some energy has thus gone somewhere else.
The question is: Where did this energy go? And are we allowed to calculate to force on the dielectric by taking the derivative of the energy with respect to the position of the dielectric?
The answer is that it depends on in what way you let the dielectric slide into the capacitor. (I consider a solid dielectric here)
If the dielectric is slowly inserted into the capacitor, there will be no energy converted into heat at all. A force is needed to prevent the dielectric from sliding in. The dielectric is thus performing work on the object that is holding it back. All the missing energy will be transferred to the object holding back the dielectric.
In this situation calculating the force from the change in energy is justified.
Note that in this situation, the voltage over the capacitor will remain constant during the insertion of the dielectric and the current that is required to charge the capacitor can be made arbitrarily low by choosing a low enough insertion velocity.
The situation changes when instead of slowly inserting the dielectric, you let go of the dielectric and it is just left to move freely into the capacitor. In that case a large current is needed to increase the charge on the capacitor. The electrical resistance in the circuit will dissipate some energy into heat. The rest of the energy is converted into kinetic energy of the dielectric.
If there is little mechanical resistance, the dielectric will shoot out the other side of the capacitor and will be pulled back again. It will oscillate in this way, until the oscillations are damped by the electrical and mechanical resistance.
In this case it is not justified to calculate the force by just considering the energy in the capacitor and battery. One should also consider the energy dissipated in the resistance.
Note that in this case the voltage over the capacitor is no longer constant. The voltage drop over the electrical resistance will cause a voltage difference between the battery and the capacitor.