Yes, the same sample can be used to conduct Confirmatory Factor Analysis (CFA) as part of Structural Equation Modeling (SEM), and this is commonly done in practice. However, whether you should do this depends on the purpose of the CFA and how you're structuring your analysis.
If your CFA is a step within your SEM process to test the measurement model before moving on to the structural model, it is standard and appropriate to use the same data.
SEM includes CFA as a component: you first confirm that your latent constructs are measured well (CFA), then test relationships between them (structural model).
In the context of SEM, CFA is called as a measurement model. Before running a SEM, you need to show that the measurement model is tenable. So, CFA is the first step in running a SEM. If the measurement model doesn't hold, running SEM will be meaningless. Running a SEM without the measurement model will lead to an automatic rejection from a journal.
Not only can the CFA be done with the same data set as the EFA (previous) but it must be done with that same data set. Otherwise the CFA would be biased: the EFA suggests a model (a variance/covariance structure) from the data and the CFA confirms that the data fit that model.
José Luis Palacios It's a common area of discussion in methodology, so I wanted to share a key principle about EFA and CFA. EFA helps you discover a potential factor structure, whereas CFA is used to test a pre-existing theory about that structure. Applying both to the same data set can make the CFA results less meaningful, as you're essentially confirming a structure you've already found. A more robust approach is to split the data or use two different samples for the two analyses. (Sorry OP, this might be slightly out of your topic.)
It seems to me that folks are responding based on two differing assumptions about what the CFA's for, both in themselves legitimate but implying different answers to the question of whether to use one dataset or two.
One context is multivariable constructs within a model of their interrelationships. (Such model can also include variables which are in themselves unitary, e.g. gender or age.) The other is determining the factorial content of multiple variables, e,g. test items or economic indices.
In the first context, it's definitely prudent to do both the CFA and the subsequent structural analysis on the same dataset. In the second, I'd recommend randomly splitting a large sample in two , doing an EFA on one half and attempting confirmation with CFA on the other. In some cases, it may make sense to impose restrictions on simple random splits and conduct separate randomizations on key variables, e.g. only child vs. child with one or more siblings.