Umar bin Dharr (may Allah have mercy on him) narrates from his father (may Allah have mercy on him) that the Messenger of Allah (peace and blessings be upon him) said: "Dawud (peace be upon him) made this prostration in repentance, and we make it in gratitude."
This is the preserved (mahfuz) version, as mursal. It has also been narrated through several routes from Umar bin Dharr, from his father, from Sa'id bin Jubayr, from Ibn Abbas, as connected (mawsul), but that is not strong.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3741