It's not entirely clear from your question, but if b and data are both std::vector<int>, then you can do five related things:
Initializing a new data with b
std::vector<int> data = b; // copy constructor
Initializing a new data with b
std::vector<int> data(begin(b), begin(b) + n); // range constructor
Copying b entirely into an existing data (overwriting the current data values)
data = b; // assignment
Copying the first n elements of b into an existing data (overwriting the current data values)
data.assign(begin(b), begin(b) + n); // range assignment
Appending the first n elements of b onto an existing data
data.insert(end(a), begin(b), begin(b) + n); // range insertion
You can also use end(b) instead of begin(b) + n if b has exactly n elements. If b is a C-style array, you can do a using std::begin; and using std::end, and the range construction/assignment/insertion will continue to work.