Star formation laws in the Andromeda galaxy: gas, stars, metals and the surface density of star formation