Mac devices have built-in Time Machine functionality that backs up your data automatically. But at times, you may forget to connect the external backup device, and hence automatic backup of data isn’t performed. If you lose data in the absence of automatic backup, you couldn’t restore the data.
If the backup drive gets corrupt, even after the automatic back up was ON, you’d lose all the data stored on it.
In both the cases, you’d need to contact a data recovery expert.