Dependence of galaxy clustering on UV luminosity and stellar mass at z 4-7