The CDC has published data on this multiple times... Vaccination seems to be more protective than a past infection. A past infection is approximately equal to a single dose of a two-dose vaccine.
e.g. CDC MMWR August 2021, https://www.cdc.gov/mmwr/volumes/70/wr/mm7032e1.htm "These findings suggest that among persons with previous SARS-CoV-2 infection, full vaccination provides additional protection against reinfection. To reduce their risk of infection, all eligible persons should be offered vaccination, even if they have been previously infected with SARS-CoV-2."