I always go by the rule Chapter is to Tab. Paragraph is to Collapsible Panel.
When you have 2 hierarchies, the broader of the two levels are tabs and the other ought to be for collapsible panels.
For complex applications, there are more than 3 levels. Whatever you do, don't implement the same UI division to the next immediate generation. This means that if level 1 is tabs, level 2( its immediate children) should not be tabs but something else. I see that the first screenshot violated this "rule". Remember the good old outline:
I. Main Point 1
A. Section 1
B. Section 2
II. Main Point 2
A. Section 1
B. Section 2
1. Part 1
2. Part 2
Otherwise, three levels implemented by the same UI will look like
I. Main Point 1
I. Section 1
II. Section 2
II. Main Point 2
I. Section 1
II. Section 2
I. Part 1
II. Part 2
You don't want this.
But what if there is only 1 level? Which one is better? Keep in mind that you can only see one tab content at any one time while you can expand/collapse multiple panels.
I have the tendency to use collapsible panels when I'm working with one entity with many properties I can categorize. For example, when working with a patient (in medical billing software), name, address, SSN, and contact info will be under one panel, and their insurance coverage will be in another panel. Medical staff often want to see all panels open most of the time and collapse them (for less content) when they're having mental fatigue.
For tabs, you must answer "yes" to the question "Can the user work in one tab without needing to see information in another tab?" A "no" means definitely don't use tabs. A "yes" means possible tabs, but you'll have to check many other things.