Question: Should I do both squats and deadlifts in the same workout, or should I alternate between them?
Answer: Whether you should perform both squats and deadlifts in the same workout depends on how intensely you are doing them, how many other exercises you are performing, and how much volume you can effectively recover from.
After performing the first of these, are you able to consistently perform the second exercise in the same workout with a high intensity of effort?
Are you making steady progress on both exercises?
Do your legs feel like they are recovering sufficiently in the days following your workout?
If the answer to any of these is no, you should only perform one or the other, but not both in the same workout.
Most beginners will have no trouble performing both squats and deadlifts in the same full-body workout because they have not yet learned to push themselves hard enough for this to be excessive, however as you learn to train more intensely you may find you have difficulty maintaining a high level of effort for more than one compound leg exercise, or in some cases more than a few compound exercises total. Also, as you get bigger and stronger and are working more muscle mass, more intensely, the demands on recovery increase.
If you find you are able to perform the first of these in your workout with a high intensity of effort and make steady progress, but have difficulty getting through the second or make little or no progress on it, you may need to cut one of them, alternate between them, or cut other exercises to avoid overtraining. This applies to other exercises, too. Minimally, you need to perform enough exercise in your program (but not every workout) to effectively work all of the major muscle groups, but you should not perform so many exercises in each workout that you can not perform each of them with a high level of intensity.
I usually have new clients perform both in the same workout when starting out, then as they get stronger and learn to train more intensely and need a reduction in volume I either split the exercises up into two shorter full-body workouts or into an upper body workout and a lower body workout. Because there is a lot of overlap between squats and deadlifts I usually have clients perform stiff-legged deadlifts instead of regular deadlifts if they are performed in the same workout. As an alternative, you could perform regular deadlifts and sissy squats. For specific examples of this read High Intensity Workouts.
It helps to think of squats and deadlifts as points on a continuum of compound leg exercises, with sissy squats on the left with little or no hip extension and a lot of knee extension, and stiff-legged deadlifts on the right with little or no knee extension and a lot of hip extension. Both squats and deadlifts are pretty close to the middle of this continuum, with squats a little closer to the left and deadlifts a little closer to the right. Pairing one of these exercises in the middle of the continuum with one far down the opposite end minimizes overlap.
Another option is to substitute a less systemically demanding simple exercise for one of the compound exercises, alternating between workouts. For example, instead of squats and deadlifts, you could perform squats and leg curls or hip extensions on one workout, and deadlifts and leg extensions on the other.