Which one you should perform entirely depends on your fitness level and goal. Both of them are basic exercises and targets more or less the same set of muscles. If you are a beginner, we would recommend you opt for bodyweight squats. It is the basic kind of exercise and every beginner must master it before attempting something more intense like strength training.
If you are interested in building back and core strength, with your leg and glute muscles, the deadlift should be your pick. This exercise helps you target the glutes and hamstrings more deeply than squats.
If you are experiencing knee pain, then squats may aggravate your issue. In deadlifts, you do not have to put as much pressure as squats, so it can be better for your painful knees. But for people suffering from lower back pain or injuries, squats are better than deadlifts.